## STUDY 1 DATA PREPARATION

library(dplyr)

## set your working directory

metoo1 <- read.csv("study1_replication_raw.csv")

metoo1 <- subset(metoo1, is.na(resign)==F) ## filter respondents who failed attention check or dropped out by outcome measure

## Belief measures before or after communication treatment
metoo1$response <- NA
metoo1$response[metoo1$treat_mani == "confession"] <- "apology"
metoo1$response[metoo1$treat_mani == "denial"] <- "denial"
metoo1$response[metoo1$treat_mani == "control"] <- "prior" ## belief measured after allegation, but before communication
metoo1$response <- as.factor(metoo1$response)
metoo1 <- within(metoo1, response <- relevel(response, ref = "prior")) ## set prior as reference level


metoo1$scandal_sex[metoo1$scandal_sex == "1"] <- "affair"
metoo1$scandal_sex[metoo1$scandal_sex == "2"] <- "harassment"
metoo1$scandal_sex[metoo1$scandal_sex == "3"] <- "sexting"
metoo1$scandal_sex[metoo1$scandal_sex == "4"] <- "assault"
metoo1$scandal_sex[metoo1$scandal_sex == "5"] <- "rape"

metoo1$scandal_sex <- as.factor(metoo1$scandal_sex)
metoo1 <- within(metoo1, scandal_sex <- relevel(scandal_sex, ref = "affair"))

## final dataset for study 1 analysis
metoo1 <- metoo1 %>% dplyr::select(id, communication:scandal_party_congruence, response, likely:seriousness)
#write.csv(metoo1, "study1_replication_analysis.csv")
